package org.example;

import cn.hserver.core.ioc.annotation.Bean;
import cn.hserver.plugin.gateway.bean.Http4Data;
import cn.hserver.plugin.gateway.business.BusinessHttp4;
import cn.hserver.plugin.gateway.business.BusinessHttp7;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.multipart.HttpData;

import java.net.InetSocketAddress;
import java.net.SocketAddress;

@Bean
public class MyBusinessHttp4 extends BusinessHttp4 {

    @Override
    public SocketAddress getProxyHost(ChannelHandlerContext ctx, Http4Data http4Data, SocketAddress sourceSocketAddress) {
          return new InetSocketAddress("127.0.0.1",8888);
    }

    @Override
    public Object in(ChannelHandlerContext ctx, Http4Data http4Data) {
//        System.out.println(http4Data.getData());
        return super.in(ctx, http4Data);
    }

    @Override
    public Object out(Channel channel, Object obj) {
        return super.out(channel, obj);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
    }
}
